function say(name) {
    console.log('你好' + name)
}

var hi = function () {
    console.log('hi')
    return 5
}

function f(x) {
    return x + 1
}
// f(x) = x + 1
// f(1)
//将字符串 ”abcabcabc” 中的 “a“ 替换成 ”x”,使用replace方法，
var str2 = "abcabcabc"
// var res2 = str2.replace(/a/g,'x')

// raplaceAll(str,serachValue,repalceValue)
// while(str2.indexOf('a') != -1){
//     str2 = str2.replace('a','x')
// }

function repalceAll(str, serachValue, repalceValue) {
    while (str.indexOf(serachValue) != -1) {
        str = str.replace(serachValue, repalceValue)
    }
    return str
}
var s = 'abcafdbadfdaaaade'
var n = repalceAll(s,'a','x')